Repository navigation
K2GO-422 feat(forgejo): post-install "Install repos" action + status endpoint - #593
Merged
Merged
Conversation
Add GET /k2go-api/forgejo/status so the app can decide the post-install repos
action without mutating anything. It returns { reachable, adminExists,
adminAuthenticable, repos, manageable } from in-process HTTP to the forge API
(no CLI, no fork), so it answers even when dash-node is off-proot (unlike the
seed). manageable = we authenticate as the K2Go admin, OR the admin is absent so
the seed can create it; a K2Go admin that exists but cannot be authenticated
(password changed) is not manageable, so the app blocks instead of guessing.
dash-node 1.3.5 -> 1.3.6 (package.json + CHANGELOG).
On an installed Forgejo, the module detail now offers "Install example repositories" when the box status (GET /forgejo/status) says the forge is manageable and has no repos yet. Tapping it enqueues the seed to the tasks index Get More style: bank the seed, start the foreground ForgejoSeedService, and open SetupProgressActivity, which tracks the running seed to completion via a new EXTRA_FORGEJO_SEED launch flag. - ForgejoStatusClient: reads the box status; canInstallRepos / hasRepos / blocked. - SetupProgressActivity: EXTRA_FORGEJO_SEED marks a post-install seed run, so the completion gate waits on it (seedPendingRun = ... && (moduleShown || postInstallSeed)) and the seed row shows. The stranded case (a banked seed leaking into an unrelated Get More flow) has neither signal, so it still does not block: no hang reintroduced. - ModuleDetailFragment: the installed branch queries the status off the main thread and shows "Install repos", nothing (repos present), or a blocked note (an admin exists that K2Go cannot authenticate). Update/refresh of existing repos (non-destructive) remains a later deliverable (K2GO-422 section A). New strings are parked for translation before merge.
…action Device test: the "Install repos" button returned "done" in ~6 ms without seeding. The box seed status is a single shared marker; the prior admin/org seed left it "done", and ForgejoSeedClient.drive short-circuits on a leftover "done" before it POSTs (finding D, deferred from the analysis, now hit). Add drive(includeRepos, force, listener): force ignores the leftover "done" and POSTs a fresh seed (the box POST rewrites the status to "running" synchronously, so the poll follows the fresh run); non-forced keeps the re-attach optimization for the install flow. ForgejoSeedService.start(ctx, force) threads it; the post-install button forces. Device-validated on arm64: the seed ran ~58 s and adopted the 3 example repos.
Two-pass review follow-ups on the status path: - ForgejoStatusClient: raise the read timeout to 30s. The box makes a couple of short forge calls before answering, and a 10s client timeout could expire on a warming forge, silently hiding the "Install repos" button. - forgejo.status.ts: run the independent probes (public users lookup + authed /user) with Promise.allSettled instead of sequentially, and lower the per-call timeout to 5s, so the worst-case latency is roughly halved.
…t/K2GO-422-forgejo-repos-post-install
… locales Migrate k2go_forgejo_install_repos and k2go_forgejo_repos_blocked from strings_untranslated.xml into strings.xml (English) and all 33 locale files. Machine translations, marked for human review. Tracker is empty again.
Third-pass review: seedPendingRun released the completion gate on
mq.didFail("forgejo") in the post-install flow too, where the module queue is a
stale/unrelated verdict. Scope it to moduleShown so a post-install seed run
waits on its own state. Behavior-preserving for the module-install and
post-install flows; closes the fragile coupling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes:
On an installed Forgejo with no example repos, the module detail ("About this
app") now offers "Install example repositories". Tapping it seeds the repos Get
More style: it banks the seed, starts the foreground ForgejoSeedService, and
opens SetupProgressActivity, which tracks the running seed to completion, then
opens the Library.
Box:
adminAuthenticable, repos, manageable }, from in-process HTTP to the forge API
(no CLI, no fork, so it answers even when dash-node is off-proot). manageable =
we authenticate as the K2Go admin OR the admin is absent (the seed can create
it); an admin we cannot authenticate is not manageable, so the button is
withheld instead of guessing.
App:
(manageable and no repos yet), nothing (repos present), or a blocked note.
tracked there; no separate progress screen.
short-circuited by a prior seed's leftover "done" status (a single shared
marker); the box POST rewrites the status to "running" synchronously.
Why:
Declining the example repos at install (or a seed that did not finish) leaves the
forge without them, with no way to add them later. This is a one-tap,
box-state-driven way to seed the repos onto an already-installed forge.
Scope:
First deliverable of K2GO-422 (the post-install repos action). The
non-destructive "Update repos" refresh and the general module-update path are
later deliverables.
Verification:
Device-validated on arm64: on a forge with admin and org but no repos, the button
appeared, seeded the 3 example repos, and returned to the Library. Multi-pass
code review done.